<?php

class Ead_LinkuteisController extends Ead_Controller_Action
{

    private $_table     = 'LINKUTEIS ';
    private $_pk        = 'LNK_ID';
    private $_order_col = 'LNK_ORD';
    private $_order     = 'ASC';
    private $_sta_col   = 'LNK_STA';
    private $obj        = '';
    private $form       = '';
    
    public function init()
    {
    
    }

    public function indexAction() {
        //$this->_helper->redirector('edit');
        
        Zend_Loader::loadClass('tools','library');
        
        $where = 'l.'.$this->_pk . ' > 0';
        
        //$STA = $this->_getParam($this->_sta_col, 1);
        //$where .= ' and ' . $this->_sta_col . ' = ' . $STA;
        
        //$result = $this->obj->fetchAll($this->obj->select()->where($where)->order($this->_order_col.' '.$this->_order));
        //$this->view->result = $this->paginacao($result);
        $query = 'SELECT SQL_CACHE l.*, d.DCP_COR FROM '.$this->_table.' l, PROFESSOR p, DISCIPLINA d '
                .' WHERE '.$where.''
                .' AND l.USU_ID = p.USU_ID AND p.DCP_ID = d.DCP_ID '
                .' ORDER BY l.'.$this->_order_col.' '.$this->_order;
        $result = $this->db->fetchAll($query);
        $this->view->result = $this->paginacao($result);
        
    }
    
}